<template>
  <div class="my-counter">
    <!-- counter 计数器 -->
    <!-- 减 -->
    <button type="button" class="btn btn-light" @click="jian">-</button>
    <!-- 数量 -->
    <input type="number" class="form-control inp" v-model.number="shuliang"  />
    <!-- 加 -->
    <button type="button" class="btn btn-light" @click="jia">+</button>
    
  </div>
</template>

<script>
export default {
  props:['item'],
  data() {
    return {
      shuliang: 1,
      // item.goods_count
    };
  },
  methods: {
    // 加减
    jian() {
      if (this.shuliang >= 1) {
        this.shuliang--;
      }
    },
    jia() {
      this.shuliang++;
    },
    // kong(){
    //   if (this.shuliang === '')  {
    //     this.shuliang === 1
    //   }
    // },
    ziXF(){
      this.$emit('zhi', this.shuliang)
    }
  },
  computed:{
    // 总价（未测试）
    
    
  }
};
</script>

<style lang="less" scoped>
.my-counter {
  display: flex;
  .inp {
    width: 45px;
    text-align: center;
    margin: 0 10px;
  }
  .btn,
  .inp {
    transform: scale(0.9);
  }
}
</style>
